'''
高阶函数
'''


def func1():
    print('fun1')
    return 100


nums = [11, 59, 95, 60, 28, 16]

# 排序方法
nums.sort(key=lambda num: num % 10)
print(nums)
students = [
    {'name': 'xm', 'age': 18, 'score': 90},
    {'name': 'lh', 'age': 20, 'score': 56},
    {'name': 'lis', 'age': 22, 'score': 90},
    {'name': 'xh', 'age': 17, 'score': 50}
]

students.sort(key=lambda stu: stu['age'] + stu['score'])
print(students)
print()
nums = [11, 59, 95, 60, 28, 16]
max1 = max(students, key=lambda stu: stu['score'])
print(max1)

# 练习
list1 = []  # [lambda x:x*4]
for i in range(5):
    list1.append(lambda x: x * i)

print(list1[1](2), list1[2](2), list1[3](2))

list2 = []

# 2
def func2(seq=[]):
    seq.append(100)
    return seq


print(func2())
print(func2())
